package cn.ffcs.util.tag;

import java.util.Date;

import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.tagext.TagSupport;

/**
 * 
 * 时间对比标签<br/> <table>
 * <tr>
 * <td>负责人/principal: </td>
 * <td colspan="2">liuzhh</td>
 * <tr>
 * <td>修改记录/revision:</td>
 * <td colspan="2"></td>
 * </tr>
 * <tr>
 * <td>日期:</td>
 * <td>修改人:</td>
 * <td>修改说明:</td>
 * </tr>
 * <tr>
 * <td></td>
 * <td></td>
 * <td></td>
 * </tr>
 * </table>
 * @author liuzhh
 * @version $Id$
 */
public class CompareTimeTag extends TagSupport
{
    
    /** 网络标识 */
    private static final long serialVersionUID = 8338729529377613088L;
    /** 输入时间 **/
    private Date inTime;
    
    /**
     * 标签起始
     */
    public int doStartTag() throws JspTagException{
        
        Date date=new Date();
        Date day=new Date(date.getYear(),date.getMonth(),date.getDate());
        Date inDay=new Date(inTime.getYear(),inTime.getMonth(),inTime.getDate());
        
        //比较输入时间和当前时间是否相同
        int result=day.compareTo(inDay);
        
        if (result<=0) return EVAL_BODY_INCLUDE;

        return SKIP_BODY;
    }
    
    /**
     * 标签结束
     */
    public int doEndTag() throws JspTagException{

        return EVAL_PAGE;
    }


    /**
     * @return the inTime
     */
    public Date getInTime()
    {
        return inTime;
    }


    /**
     * @param inTime the inTime to set
     */
    public void setInTime(Date inTime)
    {
        this.inTime = inTime;
    }
}
